home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / Slider.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-12-16  |  1.7 KB  |  90 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Canvas;
  4. import java.awt.Component;
  5. import java.awt.Dimension;
  6.  
  7. public abstract class Slider extends Canvas {
  8.    public static final int TICK_LEFT = 0;
  9.    public static final int TICK_RIGHT = 1;
  10.    public static final int TICK_BOTTOM = 0;
  11.    public static final int TICK_TOP = 1;
  12.    public static final int TICK_BOTH = 2;
  13.    public static final int TICK_NONE = 3;
  14.    protected boolean enabled;
  15.    protected int width;
  16.    protected int height;
  17.    protected int style;
  18.    protected int freq;
  19.    protected int min;
  20.    protected int max;
  21.    protected int prevPos;
  22.    protected int curPos;
  23.    protected boolean showBorder;
  24.  
  25.    protected Slider() {
  26.    }
  27.  
  28.    public int getTickStyle() {
  29.       return this.style;
  30.    }
  31.  
  32.    public void setMinValue(int var1) {
  33.       this.min = var1;
  34.       ((Component)this).invalidate();
  35.    }
  36.  
  37.    public int getMinValue() {
  38.       return this.min;
  39.    }
  40.  
  41.    public void setMaxValue(int var1) {
  42.       this.max = var1;
  43.       ((Component)this).invalidate();
  44.    }
  45.  
  46.    public int getMaxValue() {
  47.       return this.max;
  48.    }
  49.  
  50.    public void setTickFreq(int var1) {
  51.       this.freq = var1;
  52.       ((Component)this).invalidate();
  53.    }
  54.  
  55.    public int getTickFreq() {
  56.       return this.freq;
  57.    }
  58.  
  59.    public void setValue(int var1) {
  60.       this.doMove((var1 - this.min) / this.freq, false);
  61.    }
  62.  
  63.    public int getValue() {
  64.       return this.curPos * this.freq + this.min;
  65.    }
  66.  
  67.    public void setShowBorder(boolean var1) {
  68.       this.showBorder = var1;
  69.       ((Component)this).invalidate();
  70.    }
  71.  
  72.    public boolean getShowBorder() {
  73.       return this.showBorder;
  74.    }
  75.  
  76.    public synchronized void enable() {
  77.       super.enable();
  78.    }
  79.  
  80.    public synchronized void disable() {
  81.       super.disable();
  82.    }
  83.  
  84.    public Dimension preferredSize() {
  85.       return new Dimension(this.width, this.height);
  86.    }
  87.  
  88.    protected abstract void doMove(int var1, boolean var2);
  89. }
  90.